package cn.edu.cug.cs.gtl.renders.openinventor.meshes;

import cn.edu.cug.cs.gtl.apis.render.meshes.CoordinatesInfo;
import com.openinventor.meshviz.data.PbMesh;

import java.nio.FloatBuffer;

public class CoordinatesInfoImpl implements CoordinatesInfo {
    private PbMesh.CoordinatesInfo nativeObject = null;
    public CoordinatesInfoImpl(PbMesh.CoordinatesInfo v){
        this.nativeObject = v;
    }
    @Override
    public Object getNativeObject() {
        return nativeObject;
    }

    @Override
    public boolean attach(Object nativeObject) {
        if(nativeObject instanceof  PbMesh.CoordinatesInfo){
            this.nativeObject = (PbMesh.CoordinatesInfo) nativeObject;
            return true;
        }
        return false;
    }

    @Override
    public Object detach() {
        Object r = this.nativeObject;
        this.nativeObject=null;
        return r;
    }

    @Override
    public FloatBuffer getXOrdinates() {
        return nativeObject.xnod;
    }

    @Override
    public FloatBuffer getYOrdinates() {
        return nativeObject.ynod;
    }

    @Override
    public FloatBuffer getZOrdinates() {
        return nativeObject.znod;
    }
}
